<!-- File: /application/views/index-surat -->
<div id="icon-edit" class="icon32"><br /></div>
<h2>Surat Keluar <?=strtoupper($kap);?>
<?=anchor('surat/add/'.$kap,'Add New '.strtoupper($kap),array('class'=>'button add-new-h2'));?>
<?=anchor('surat/excel','Transfer ke Excel',array('class'=>'button add-new-h2'));?>
</h2>

<?php //echo $form->create('Surats',array('controller'=>'surats','action'=>'index')); ?>
<p></p>
<?=form_open('surat/action/');?>
<p class="search-box">
<?php if(($this->session->userdata('no_surat')=='') AND ($this->session->userdata('klien_surat')=='') ) :?>
	 No Surat
	<input type="text" id="post-search-input" name="no" value="" />
	 Nama Klien
	<input type="text" id="post-search-input" name="s" value="" />	
	<input type="submit" value="Search" name="search" class="button" />
<?php else:?>
	<input type="submit" value="Reset" name="reset" class="button" />
<?php endif;?>	
</p>
<?=form_close();?>
<br/>
<p></p>
<!--
<input type="hidden" name="post_status" class="post_status_page" value="all" />
<input type="hidden" name="post_type" class="post_type_page" value="post" />
<input type="hidden" name="mode" value="list" />
-->

<div class="tablenav">

<?=form_open('surat/date/');?>
<div class="alignleft actions">
<!--
<select name="action">
<option value="-1" selected="selected">Bulk Actions</option>
<option value="edit">Edit</option>
<option value="trash">Move to Trash</option>
</select>
<input type="submit" value="Apply" name="doaction" id="doaction" class="button-secondary action" />
<input type="hidden" id="_wpnonce" name="_wpnonce" value="320265c495" /><input type="hidden" name="_wp_http_referer" value="/wordpress/wp-admin/edit.php" />
-->

<?php if($this->session->userdata('tgl_surat_awal')==''):?>
Dari
<select name='dd'>
<?php for($i=1;$i<=31;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

<select name='mm'>
<?php for($i=1;$i<=12;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

<select name='yyyy'>
<?php for($i=2010;$i<=2012;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

s/d
<select name='dd2'>
<?php for($i=1;$i<=31;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

<select name='mm2'>
<?php for($i=1;$i<=12;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

<select name='yyyy2'>
<?php for($i=2010;$i<=2012;$i++){ ?>
<?php if($i>9){?>
<option value='<?php echo $i; ?>'><?php echo $i; ?></option>
<?php } else { ?>
<option value='<?php echo '0'.$i; ?>'><?php echo '0'.$i; ?></option>
<?php } ?>
<?php } ?>
</select>

<input type="submit" name="search" id="post-query-submit" value="Search" class="button-secondary" />
<?php else:?>
<input type="submit" name="reset" id="post-query-submit" value="Reset" class="button-secondary" />
<?php endif;?>
</div>
<?=form_close();?>

<div class="clear"></div>
</div>

<div class="clear"></div>

<table class="widefat post fixed" cellspacing="0">
	<!-- Head -->
    <thead>
	<tr>
	<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
	<th scope="col" id="title" >No.Surat</th>
	<th scope="col" id="author" >Tanggal</th>
	<th scope="col" id="categories">Nama Klien</th>
	<th scope="col" id="tags">Alamat</th>
	<th scope="col" id="date">Keterangan</th>
    <th scope="col" id="rem"></th>
	</tr>
	</thead>
   <!-- Head -->
   <!-- Footer -->
	<tfoot>
	<tr>
	<th scope="col"><input type="checkbox" /></th>
	<th scope="col">No.Surat</th>

	<th scope="col">Tanggal</th>
	<th scope="col">Nama Klien</th>
	<th scope="col">Alamat</th>
	<th scope="col">Keterangan</th>
    <th scope="col"></th>
	</tr>
	</tfoot>
    <!-- Footer -->

	<tbody>
	<?php if(count($surats)>0):?>
	<?php foreach($surats as $rec): ?>
    <tr id='post-4' class='alternate author-self status-publish iedit' valign="top">
    <td><a href="#">#</td>
    <td><a href="#"><?=$rec['no_surat']; ?></a></td>
    <td><a href="#"><?=$rec['tanggal']; ?></a></td>
    <td><a href='#'><?=$rec['nama_klien']; ?></a></td>
    <td><?=$rec['alamat'];?></td>
    <td><?=$rec['keterangan']; ?></td>
    <td><br />
	<?php //if(date("Y-m-d") == $rec['tanggal']): ?>
	<?=anchor('surat/edit/'.$rec['id'].'/'.$kap,'Edit',array('class'=>'button add-new-h2')); ?><p></p>
	<?=anchor('surat/remove/'.$rec['id'],'Remove',array('class'=>'button add-new-h2')); ?>
	<?php //endif; ?>
	</td>	     
   </tr>
   <?php endforeach; ?>
   <?php endif;?>   
	</tbody>
</table>

<?php //$this->load->view('paging');?>


</form>

